﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace JinianNet.IO
{
    public class File
    {
        public static string ReadAllText(string path)
        {
            return System.IO.File.ReadAllText(path);
        }

        public static string ReadAllText(string path,Encoding encoding)
        {
            return System.IO.File.ReadAllText(path, encoding);
        }

        public static long DirectorSize(DirectoryInfo d)
        {
            long Size = 0;
            FileInfo[] fis = d.GetFiles();
            foreach (FileInfo fi in fis)
            {
                Size += fi.Length;
            }

            DirectoryInfo[] dis = d.GetDirectories();
            foreach (DirectoryInfo di in dis)
            {
                Size += DirectorSize(di); 
            }
            return Size;
        }
    }
}
